﻿//---------------------------------------------------------------------------------------------
//  Copyright 2009 Jeremy Palenchar
//  http://identitynotes.palenchar.net
//
//  This file is part of the Identity Notes Identity Notes Sample Custom Activity Library.
//
//  The Identity Notes Sample Custom Activity Library is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  The Identity Notes Sample Custom Activity Library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//  
//  You should have received a copy of the GNU General Public License
//  along with The Identity Notes Sample Custom Activity Library.  If not, see <http://www.gnu.org/licenses/>.
//--------------------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using Microsoft.ResourceManagement.WebServices.WSResourceManagement;
using Microsoft.ResourceManagement.WebServices;
using Microsoft.ResourceManagement.Workflow.Activities;

namespace IdentityNotes.Examples.CustomActivityLibrary
{
	public partial class getRequestTargetActivity: SequenceActivity
	{
		public getRequestTargetActivity()
		{
			InitializeComponent();
		}

        public static DependencyProperty RequestProperty = DependencyProperty.Register("Request", typeof(RequestType), typeof(CustomActivityLibrary.getRequestTargetActivity));

        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        [BrowsableAttribute(true)]
        [CategoryAttribute("Properties")]
        public RequestType Request
        {
            get
            {
                return ((RequestType)(base.GetValue(CustomActivityLibrary.getRequestTargetActivity.RequestProperty)));
            }
            set
            {
                base.SetValue(CustomActivityLibrary.getRequestTargetActivity.RequestProperty, value);
            }
        }

        public static DependencyProperty RequestTargetProperty = DependencyProperty.Register("RequestTarget", typeof(System.Guid), typeof(CustomActivityLibrary.getRequestTargetActivity));

        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        [BrowsableAttribute(true)]
        [CategoryAttribute("Properties")]
        public System.Guid RequestTarget
        {
            get
            {
                return ((System.Guid)(base.GetValue(CustomActivityLibrary.getRequestTargetActivity.RequestTargetProperty)));
            }
            set
            {
                base.SetValue(CustomActivityLibrary.getRequestTargetActivity.RequestTargetProperty, value);
            }
        }

        public static DependencyProperty RequestCreatorProperty = DependencyProperty.Register("RequestCreator", typeof(System.Guid), typeof(CustomActivityLibrary.getRequestTargetActivity));

        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        [BrowsableAttribute(true)]
        [CategoryAttribute("Properties")]
        public System.Guid RequestCreator
        {
            get
            {
                return ((System.Guid)(base.GetValue(CustomActivityLibrary.getRequestTargetActivity.RequestCreatorProperty)));
            }
            set
            {
                base.SetValue(CustomActivityLibrary.getRequestTargetActivity.RequestCreatorProperty, value);
            }
        }

        private void populateRequestTarget_ExecuteCode(object sender, EventArgs e)
        {
            //Do some trickery here to convert the Web.UniqueIdentifer into a Guid that can be used later.
            this.RequestTarget = (System.Guid)this.Request.Target;
            this.RequestCreator = (System.Guid)this.Request.Creator;
        }
	}
}
